package com.xiaoxing.salesclient.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.xiaoxing.salesclient.mvp.contract.GeRenZhongXinContract;
import com.xiaoxing.salesclient.mvp.model.entity.OrderPay;
import com.xiaoxing.salesclient.mvp.model.entity.UserCenter;
import com.xiaoxing.salesclient.mvp.model.service.SalesService;

import io.reactivex.Observable;


@ActivityScope
public class GeRenZhongXinModel extends BaseModel implements GeRenZhongXinContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public GeRenZhongXinModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<UserCenter> userCenter(String access_token) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).userCenter(access_token);
    }

    @Override
    public Observable<UserCenter> userInfo(String access_token, String uid) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).userInfo(access_token,uid);
    }

    @Override
    public Observable<OrderPay> orderPay(String access_token, String order_no) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).orderPay(access_token, order_no);
    }
}